package com.bartender.consumer.controller;

import com.bartender.common.core.domain.AjaxResult;
import com.bartender.consumer.service.IWxAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/wx/auth")
public class WxAuthController {
    
    @Autowired
    private IWxAuthService wxAuthService;

    @PostMapping("/login")
    public AjaxResult login(@RequestParam String code) {
        try {
            return AjaxResult.success(wxAuthService.login(code));
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

//    @PostMapping("/register")
//    public AjaxResult register(@RequestBody VxUser vxUser, @RequestParam String openid) {
//        try {
//            vxUser.setOpenid(openid);
//            return AjaxResult.success(wxAuthService.register(vxUser));
//        } catch (Exception e) {
//            return AjaxResult.error(e.getMessage());
//        }
//    }
} 